#include<iostream>
#include<cmath>
using namespace std;
class Money
{
public:
    Money(int y,int j,int f)
    {
        sum=y*100+j*10+f;
        flag= (sum>=0?1:-1);
        sum=abs(sum);
    }

    Money(int f=0):sum(f)
    {
        flag= (sum>=0?1:-1);
        sum=abs(sum);
    }

    Money operator-(const Money& other)
    {
        int tmp;
        tmp= this->flag*this->sum - other.flag*other.sum;
        return Money(tmp);
    }

    friend ostream& operator<<(ostream& out,Money m);

private:
    int flag;   //金额的符号位，负金额为-1，否则1
    int sum;  //以“分”单位的总金额
};

ostream& operator<<(ostream& out,Money m)
{
    int yuan,jiao,fen;
    yuan=m.sum/100;
    fen=m.sum%10;
    jiao=m.sum%100/10;
    if(m.flag==-1)
        out<<'-';
    out<<yuan<<"."<<jiao<<fen;
    return out;
}
int main()
{
    Money x1(2,2,3),x2(3,2,2),x3;
    x3=x1-x2;
    cout<<x3<<endl;
    return 0;
}
